package org.mike.RemoteTest;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * Servlet开发基本步骤
 * 1>写一个类继承HttpServlet
 * 2>重写doGet或者doPost 方法
 * 3>在web.xml中注册   注册Servlet
 * 4>发布应用
 */
public class FirstServlet extends HttpServlet {
    /**
     * key=value&
     * @param req
     * @param resp
     * @throws ServletException
     * @throws IOException
     */
    @Override
    //1
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher( "test.jsp").forward(req, resp);;
    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }

    @Override
    protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPut(req, resp);
    }

    @Override
    protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doDelete(req, resp);
    }
}